<!--
 * @文件名称：  formValit.vue
 * @包路径：
 * @版权所有： 小树苗 (C) 2020
 *
 * @文件描述:
 * @版本:
 * @作者        zhangshumiao
 * @创建时间    2020/4/27 21:40
 *
 * @修改记录：
  -----------------------------------------------------------------------------------------------
   ----------- 时间      |   修改人    |     修改的方法       |         修改描述   ---------------
  -----------------------------------------------------------------------------------------------
-->
<template>
<el-row>
  <el-form :model="form" ref="form" :rules="rules" style="width: 40%;" label-width="100px" :status-icon=status>
    <el-form-item label="活动名称" prop="name">
      <el-input v-model="form.name" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="年龄" prop="age">
      <el-input v-model="form.age" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="date1" prop="date1">
      <el-input v-model="form.date1" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="date2" prop="date2">
      <el-input v-model="form.date2" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="城市" prop="city">
      <el-input v-model="form.city" autocomplete="off" @blur="city"></el-input>
    </el-form-item>
    <el-button type="primary" @click="addEdit">确 定</el-button>
  </el-form>
</el-row>
</template>

<script>
export default {
  name: 'formValit',
  data() {
    return {
      form: {
        name: '',
        age: '',
        date1: '',
        date2: '',
        city: ''
      },
      status: false,
      rules: {
        name: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
        ],
        age: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
        ],
        date1: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
        ],
        date2: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
        ],
        city: [
          { required: false, message: '请输入活动名称', trigger: 'blur' },
          {
            pattern: /^\d{6}$/,
            message: '请输入正确的身份证号码',
            trigger: 'blur'
          }
        ],
      }
    }
  },
  methods: {
    addEdit() {
      this.$refs.form.validate(valid => {
        if (valid) {

        }
      })
    },
    city() {
      if (this.form.city == '') {

      }
    }
  }
}
</script>

<style>

</style>
